import {
  createRouter,
  createWebHistory,
  createWebHashHistory,
} from "vue-router";
import pageGuard from "./guard/pageGuard";
import { routeBase } from "./route";

const routes = [...routeBase];

const history =
  import.meta.env.VITE_ROUTER_MODE === "history"
    ? createWebHistory()
    : createWebHashHistory();

const router = createRouter({
  history,
  routes,
});

pageGuard(router);

export default router;
